package com.tcm.order.service.settlement;


import com.base.genid.generator.UidGenerator;
import com.tcm.order.entity.SettlementOrderDay;
import com.tcm.order.dao.mapper.SettlementOrderDayMapper;
import com.tcm.order.service.SettlementOrderDayService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;
import java.util.List;

@DubboService(version = "0.0.1-alpha", timeout = 6000, retries = 3, delay = -1)
public class SettlementOrderDayServiceImpl implements SettlementOrderDayService {

    @Autowired
    private SettlementOrderDayMapper settlementOrderDayMapper;

    @DubboReference(version = "0.0.1-beta", group = "cached-uid", timeout = 6000, check = false, retries = 3)
    private UidGenerator uidGenerator;

    @Override
    public void create(SettlementOrderDay settlementOrderDay) {
        settlementOrderDay.setId(uidGenerator.getUID());
        settlementOrderDayMapper.insert(settlementOrderDay);
    }

    @Override
    public List<SettlementOrderDay> selectByEndTime(LocalDateTime endTime) {
        return settlementOrderDayMapper.selectByEndTime(endTime);
    }

    @Override
    public void updateByEndTime(LocalDateTime endTime) {
        settlementOrderDayMapper.updateByEndTime(endTime);
    }

}
